
public class Point2D {
	
	protected double x;
	protected double y;
	
	public Point2D(double x, double y) {
		super();
		this.x = x;
		this.y = y;
	}

	public Point2D() {
		super();
		
	}
	
	

	public double getX() {
		return x;
	}

	public void setX(double x) {
		this.x = x;
	}

	public double getY() {
		return y;
	}

	public void setY(double y) {
		this.y = y;
	}
	
	public double distance (Point2D a)
	{
		double d= Math.sqrt(Math.pow( (a.getX() -this.getX()),2.0) + Math.pow((a.getY()-this.getY()), 2.0));
		return d;
	}
	
	
	
	


public static void main(String args []){
	
	Point2D p1, p2;
	
	p1= new Point2D (2,3);
	p2= new Point2D (1,0);
	
	
	double dist= p1.distance(p2);
	System.out.println("distanta este:" + dist);
}

}
